"""
Common components for Parameter-Efficient Fine-Tuning (PEFT) methods.

This package contains shared base classes, utilities, and hook implementations
used across different PEFT methods, providing a consistent foundation for
hook-based model adaptation.
"""

# Import from submodules with absolute paths
# Configuration system
from continuallearning.models.pefts.common.config import (
    BasePEFTConfig,
    LoRAConfig,
    BypassLoRAConfig,
    PromptConfig,
    L2pConfig,
    CONFIG_REGISTRY,
    create_peft_config,
    create_peft_config_typed,
    config_to_dict,
    merge_configs,
    validate_config,
    merge_config_with_args,
)

# Utilities and exceptions
from continuallearning.models.pefts.common.utils import (
    PEFTError,
    ConfigurationError,
    AdapterError,
    HookError,
    HookAttachError,
    HookDetachError,
    ForwardPassError,
    handle_peft_errors,
    detect_attention_heads,
    detect_hidden_size,
    detect_model_layers,
    ModuleDetector,
    is_linear_module,
    is_conv_module,
    create_hook_factory,
)

__all__ = [
    # Configuration classes
    "BasePEFTConfig",
    "LoRAConfig",
    "BypassLoRAConfig",
    "PromptConfig",
    "L2pConfig",
    "CONFIG_REGISTRY",
    # Configuration utilities
    "create_peft_config",
    "create_peft_config_typed",
    "config_to_dict",
    "merge_configs",
    "validate_config",
    "merge_config_with_args",
    # Exception classes
    "PEFTError",
    "ConfigurationError",
    "AdapterError",
    "HookError",
    "HookAttachError",
    "HookDetachError",
    "ForwardPassError",
    # Error handling
    "handle_peft_errors",
    # Model utilities
    "detect_attention_heads",
    "detect_hidden_size",
    "detect_model_layers",
    # Module detection
    "ModuleDetector",
    "is_linear_module",
    "is_conv_module",
    "create_hook_factory",
]
